package demo1;

import java.util.Scanner;



public class Test {

    public int firstUniqChar(String s) {
        int[] count = new int[26];
        for (int i = 0; i < s.length(); i++) {
            char ch = s.charAt(i);
            count[ch - 'a']++;
        }
        for (int j = 0; j < s.length(); j++) {
            char ch = s.charAt(j);
            if (count[ch - 'a'] == 1) {
                return j;
            }
        }
        return -1;
    }

}
